<?php
use Doctrine\Common\ClassLoader,
    Doctrine\ORM\Configuration,
    Doctrine\ORM\EntityManager,
    Doctrine\Common\Cache\ArrayCache,
    Doctrine\DBAL\Logging\EchoSQLLogger;
    
    set_include_path(
        implode(
            PATH_SEPARATOR, array(
                realpath(dirname(__FILE__) . '/../../../../lib'),
                get_include_path(),
            )
        )
    );
    
    require 'wz/class.loader.php';
    
require_once '../../../../lib/Doctrine/Common/ClassLoader.php';

$loader = new \Doctrine\Common\ClassLoader('Doctrine\ORM');
            $loader->register();
            $loader = new \Doctrine\Common\ClassLoader('Doctrine\Common');
            $loader->register();
            $loader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL');
            $loader->register();
            $loader = new ClassLoader('Symfony', 'Doctrine');
            $loader->register();

$path = dirname(__FILE__);

$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();

$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();

$config = new Configuration();
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
$driver = new \Doctrine\ORM\Mapping\Driver\YamlDriver($path . '/yml');
$config->setMetadataDriverImpl($driver);


$connectionOptions = array(
    'driver' => 'pdo_mysql',
    'host' => 'localhost',
    'user' => 'ajf',
    'password' => 'ajfbdd',
    'dbname' => 'zf',
);

$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);

$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
            'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
            'dialog' => new \Symfony\Component\Console\Helper\DialogHelper(),
            'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));
\Doctrine\ORM\Tools\Console\ConsoleRunner::run($helperSet);
